<?php
if (!defined('BASEPATH'))
    exit('no direct script allowed asshole!!');
$this->load->helper('html');
?>



<!-- JavaScript -->
<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
<script src="<?= base_url() ?>js/jscal2.js"></script>
<script src="<?= base_url() ?>js/lang/en.js"></script>

<!-- CSS -->
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/border-radius.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/steel/steel.css" />

 

<div id="container">
    <fieldset class="fieldset">
        <legend class="legend">

		<?
		if ($status == "detail") {
		echo '| Detail Data Kapal |</legend>';
		} else if ($status == "edit") {
		echo '| Edit Data Kapal |</legend>';
		}
		else {
		echo '| Form Data Kapal |</legend>';
		}
		?>

        <div id="contentform" style="border:solid thin #BBBBBB; height:350px; background-color:#F9F9F9; -moz-border-radius: 5px;  padding-top:10px; padding-bottom:0.3px; margin-right:100px; margin-left:100px;">

            <!-- Start value -->
            <?
            //Setting Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
            $value = array(
                'ID_ship' => "",
                'name_of_ship' => "",
                'owner' => "",
				'ID_PEGAWAI' => "",
                'type' => "",
                'loa' => "",
                'breadth' => "",
                'height' => "",
                'draught' => "",
				'status_kapal' => "",
				'id_user' => "",
				'act_form' => "ship/upload/"
            );
			
            //Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
            if ($status == "edit") {
                $value['id_ship'] = $id_ship;
                $value['name_of_ship'] = $name_of_ship;
                $value['owner'] = $owner;
                $value['type'] = $type;
                $value['loa'] = $loa;
                $value['breadth'] = $breadth;
                $value['height'] = $height;
                $value['draught'] = $draught;
				$value['status_kapal'] = $status_kapal;
				$value['id_user'] = $id_user;
				$value['act_form'] = "ship/update/" . $value['id_ship'];
            }//end if
            ?>

            <?= form_open_multipart($value["act_form"]); ?>
           
            <!-- End value -->

            <table width="847" border="0" bordercolor="#F0F0F0">
                <tr>
                    <td width="905" height="150">
                        <form id="form1" name="form1" method="post">
                            <div align="center">
                                <table width="850" border="0">                                 
								
									<tr>
                                        <td width="180">Nama Kapal</td>
                                        <td width="208"><input name="name_of_ship" type="text" size="50" value="<?= $value['name_of_ship'] ?>"/></td>
                                        <td><? echo form_error('name_of_ship');?></td>
                                    </tr>                                                    
									<tr>
                                        <td width="180">Owner</td>
                                        <td width="208"><input name="owner" type="text" size="50" value="<?= $value['owner'] ?>"/></td>
                                        <td><? echo form_error('owner');?></td>
                                    </tr>						
									<tr>
                                        <td>Nama User</td>
                                		<td>
										<?
											$options[Null] = "-- Daftar Anggota --";
											foreach ($user->result() as $row)
											{
												$options[$row->id_user] = $row->nama;
											}
											echo form_dropdown('id_user', $options, $value["id_user"], 'class="field select"');
											if ($status=="detail")
											{
												echo form_dropdown('id_user', $options, $value["id_user"], 'class="field select" id="id_user"');
											}
										?>
										
										</td>										
                                        <td><? echo form_error('id_user');?></td>
                                    </tr>                         
									<tr>
                                        <td width="180">type</td>
                                        <td width="208"><input name="type" type="text" size="50" value="<?= $value['type'] ?>"/></td>
                                        <td><? echo form_error('type');?></td>
                                    </tr>                                 									                            
									<tr>
                                        <td width="180">loa</td>
                                        <td width="208"><input name="loa" type="text" size="50" value="<?= $value['loa'] ?>"/></td>
                                        <td><? echo form_error('loa');?></td>
                                    </tr>                                 
									<tr>
                                        <td width="180">breadth</td>
                                        <td width="208"><input name="breadth" type="text" size="50" value="<?= $value['breadth'] ?>"/></td>
                                        <td><? echo form_error('breadth');?></td>
                                    </tr>                                 
									<tr>
                                        <td width="180">height</td>
                                        <td width="208"><input name="height" type="text" size="50" value="<?= $value['height'] ?>"/></td>
                                        <td><? echo form_error('height');?></td>
                                    </tr>                                 
									<tr>
                                        <td width="180">draught</td>
                                        <td width="208"><input name="draught" type="text" size="50" value="<?= $value['draught'] ?>"/></td>
                                        <td><? echo form_error('draught');?></td>
                                    </tr>                                 
									<tr>
                                        <td width="80">Status Kapal</td>
										<td width="208">
										<?php 
											$pilihan_jk = array(
											Null => '-- Pilih Status --',
											'Aktif' => 'Aktif',
											'Tidak aktif' => 'Tidak aktif'
											);
											
											if ($status == "edit"){
											echo form_dropdown('status_kapal',$pilihan_jk,$status_kapal, 'class="field select"');
											}
											else {
											echo form_dropdown('status_kapal',$pilihan_jk,  'class="field select"');
											}
										
										?>
										</td>
										<td><? echo form_error('status_kapal');?></td>
									</tr>
									
								                                  
                                    <tr>
                                        <td height="28">&nbsp;</td>
                                        <td>
                                            <div align="left">
                                                <input type="submit" name="Submit" value="Simpan" />
												<a href="<?php echo site_url('ship/index') ?>">
												<input type="button" value="Kembali" />
												</a>

												
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </form>
                        <p align="center">&nbsp;</p></td></tr>
            </table>
        </div>
        <p>&nbsp;</p>
		
		<script type="text/javascript">//<![CDATA[

      var cal = Calendar.setup({
          onSelect: function(cal) { cal.hide() }
      });
      cal.manageFields("f_btn1", "TANGGAL_MULAI_ship", "%Y-%m-%d");
	  cal.manageFields("f_btn2", "TANGGAL_SELESAI_ship", "%Y-%m-%d");

    //]]></script>
		
    </fieldset>
</div>
<p>
    <!--container-->
</p>
<p>&nbsp; </p>

